import operate from "@dfeidao/atom-nodejs/db/operate";
import log from '@dfeidao/atom-nodejs/logger/log';
import doc_code from '@dfeidao/atom-nodejs/msg/doc-code';
import { systemid } from "../../atom/config";
interface Message {
	company_name: string;
	// 引用公司名称

	corporate: string;
	contacts_tel_one: string;
	company_unity_code: string;
	org_code: string;
	nrollment_registration: string;
	contacts_tel_two: string;
	contact: string;
	business_address: string;
}

export default async function atom(msg: Message, action_id: string, session_id: string) {
	log(`Service begin`);
	// todo

	const { exec, insert } = operate(action_id, session_id, systemid);
	const { result } = await doc_code(action_id, session_id, systemid, 'BM0013803', '', 1);
	if (result.length > 0) {
		insert('enterprise', { company_no: result });
	}
	const res = await exec();

	log(`Service end`);
	return res;
}
